package zuoye1;

import java.util.Scanner;

public class Demo7 {
    public static void main(String[] args) {
        System.out.print("请输入一个正整数:");
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int sum = 0;
        int x = 0;

        for (int i = 1; i <= n; i++) {
            if (i%2==0){
                sum = sum+i;
                x++;
            }
        }

        System.out.println("[1,n]之间的偶数和:"+sum+"一共有"+
                x+"个偶数");


    }
}
